<template>
  <div class="tab-bar-item" @click="itemClick">
    <div :class="activeStyle">
      <slot name="item-text"></slot>
      <a :class="activeAfter"></a>
    </div>
  </div>
</template>

<script>
  export default {
    name: "TabBarItem",
    props: {
      isActiveVisible: false,
    },
    data() {
      return {
        // isActive: true
      }
    },
    computed: {
      isActive() {
        return this.isActiveVisible;
      },
      activeStyle() {
        return this.isActive ? {isTabText : true} : {tabText : true}
      },
      activeAfter() {
        return this.isActive ? {isTextAfter : true} : { TextAfter :true}
      }
    },
    methods: {
      itemClick() {
        this.$emit('item-click');
      }
    }
  }
</script>

<style scoped>
  .tab-bar-item {
    text-align: center;
    display: flex;
    justify-content: space-between;
    height: 50px;
    min-width: 58px;
    font-size: 20px;
  }

  .isTabText {
    min-width: 30px;
    height: 50px;
    display:block;
    position: absolute;
    font-weight: 600;
    /*left: 50%;*/
    /*top: 50%;*/
    /*transform: translate(25%,-50%);*/
    cursor: pointer;
  }

  .tabText {
    min-width: 30px;
    height: 50px;
    display:block;
    position: absolute;
    font-weight: 500;
    /*left: 50%;*/
    /*top: 50%;*/
    /*transform: translate(25%,-50%);*/
    cursor: pointer;
  }



  .isTextAfter {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 3px;
    /*background: #0084ff;*/
    background: #ef4b3e;
    content: "";
  }

  .TextAfter{
    position: absolute;
    right: 0;
    bottom: 2px;
    left: 0;
    height: 3px;
    background: #ffffff;
    content: "";
  }

</style>